const path = require("path");
const htmlWebpackPlugin = require("html-webpack-plugin");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const webpack = require("webpack");

module.exports = {
  mode: "development",
  entry: {
    app: "./src/index.js"
    // print: './src/print.js'
  },

  devServer: {
    contentBase: "./dist",
    hot: true
  },
  plugins: [
    new CleanWebpackPlugin(["dist"]),
    new htmlWebpackPlugin({
      title: "hot module repalcement"
    }),
    new webpack.HotModuleReplacementPlugin()
  ],
  output: {
    filename: "[name].bundle.js",
    path: path.resolve(__dirname, "dist")
    // publicPath: "/"
  },
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader"]
      },
      {
        test: /\.csv$/,
        use: ["csv-loader"]
      }
    ]
  }
  // module: {
  //     rules: [
  //         {
  //             test: /\.css$/,
  //             use: [
  //                 'style-loader',
  //                 'css-loader'
  //             ]
  //         },
  //         {
  //             test: /\.(png|svg|jpg|gif)$/,
  //             use: [
  //                 'file-loader'
  //             ]
  //         },
  //         {
  //             test: /\.(csv|tsv)$/,
  //             use: ['csv-loader']
  //         },
  //         {
  //             test: /\.xml$/,
  //             use: ['xml-loader']
  //         }
  //     ]
  // }
};
